<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- 1. 定义一个含有30个整型元素的数组，按顺序分别赋予从2开始的偶数；
        然后按顺序每五个数求出一个平均值，放在另一个数组中并输出。试编程。

   ```javascript
   var arr = [2, 4, 6, 8, 10..., 60]
   
   // 结果是一个新的数组
   // var arr1 = [6, 16, 26, 36, 46, 56]
   ``` -->
    <script>
        var arr = new Array(30);
        var arr1 = []
        var sum = 0
        var xdi = 0
        for (var i = 0; i < arr.length; i++) {
            arr1[i] = (i + 1) * 2
        }
        for (var j = 0; j < arr.length; j++) {
            sum += arr[j]
            if ((j + 1) % 5 === 0) {
                arr1[xdi] = sum / 5;
                sum = 0;
                xdi++
            }
        }
    </script>

</body>

</html>